package com.gec.system.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gec.model.system.ITripHotelOrder;
import com.gec.model.system.ITripServiceOrder;
import com.gec.model.vo.ITripHotelOrderVo;
import com.gec.model.vo.ITripServiceOrderVo;
import com.gec.system.common.Result;
import com.gec.system.service.ITripHotelOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 订单表 前端控制器
 * </p>
 *
 * @author dafei
 * @since 2024-01-25
 */
@Api(tags = "酒店订单表")
@RestController
@RequestMapping("/system/itrHotelOrder")
public class ITripHotelOrderController {

    @Autowired
    private ITripHotelOrderService iTripHotelOrderService;


    // 分页 + 查询
    @ApiOperation("酒店订单分页查询")
    @GetMapping("/{page}/{limit}")
    public Result findRoleByPageQuery(@PathVariable Long page,
                                      @PathVariable Long limit,
                                      ITripHotelOrderVo iTripHotelOrderVo)
    {
        IPage<ITripHotelOrder> page1 = new Page<>(page,limit);
        page1 =   this.iTripHotelOrderService.selectPage(page1,iTripHotelOrderVo);
        return Result.ok(page1);
    }

    @ApiOperation("根据id去查询套餐订单")
    // 根据id去查询菜单
    @GetMapping("/findNodeById/{id}")
    public Result findNodeById(@PathVariable Long id){
        ITripHotelOrder iTripHotelOrder = this.iTripHotelOrderService.getById(id);
        return Result.ok(iTripHotelOrder);
    }

    @ApiOperation(value = "修改套餐订单")
    @PostMapping("/updateHotelOrder")
    public Result updateById(@RequestBody ITripHotelOrder iTripHotelOrder) {
        iTripHotelOrderService.updateById(iTripHotelOrder);
        return Result.ok();
    }

    @ApiOperation(value = "删除套餐订单")
    @DeleteMapping("/removeHotelOrder/{id}")
    public Result removeHotelOrder(@PathVariable Long id) {
        iTripHotelOrderService.removeById(id);
        return Result.ok();
    }


}

